/**
 * 活动订单管理
 */
import request from '/@/utils/request';

export function readAllActivityOrder(data?: any) {
  return request({
    url: 'activity-orders',
    method: 'post',
    data,
  });
}

export function readOneActivityOrder(id: string) {
  return request({
    url: `activity-orders/${id}`,
    method: 'get',
  });
}

export function getActivityOrderMember(id: string) {
  return request({
    url: `activity-orders/${id}/members`,
    method: 'get',
  });
}

/**
 * 核销
 * @param id
 * @returns
 */
export function writeOff(data: any) {
  return request({
    url: `activity-orders/write-off`,
    method: 'post',
    data
  });
}

/**
 * 核销
 * @param id
 * @returns
 */
export function revertWriteOff(data: any) {
  return request({
    url: `activity-orders/revert-write-off`,
    method: 'post',
    data
  });
}

/**
 * 退款
 * @param id
 * @returns
 */
export function refund(id: string) {
  return request({
    url: `activity-orders/${id}/refund`,
    method: 'post',
  });
}

/**
 * 检查状态
 * @param id
 * @returns
 */
export function checkStatus(id: string) {
  return request({
    url: `activity-orders/${id}/check-status`,
    method: 'post',
  });
}

/**
 * 检查状态
 * @param id
 * @returns
 */
export function exportData(data: any) {
  return request({
    url: `activity-orders/export`,
    method: 'post',
    data,
    responseType: 'blob'
  });
}

export function exportActivityMemberData(data: any) {
  return request({
    url: `activity-orders/export-activity-members`,
    method: 'post',
    data,
    responseType: 'blob'
  });
}
